
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>ambient.compute_pressure &#8212; Texas A&amp;M Oil spill / Outfall Calculator 2.1.0 documentation</title>
    <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="ambient.convert_units" href="ambient.convert_units.html" />
    <link rel="prev" title="ambient.stabilize" href="ambient.stabilize.html" />
   
  <link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="ambient-compute-pressure">
<h1>ambient.compute_pressure<a class="headerlink" href="#ambient-compute-pressure" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="ambient.compute_pressure">
<code class="sig-prename descclassname">ambient.</code><code class="sig-name descname">compute_pressure</code><span class="sig-paren">(</span><em class="sig-param">z</em>, <em class="sig-param">T</em>, <em class="sig-param">S</em>, <em class="sig-param">fs_loc</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/ambient.html#compute_pressure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ambient.compute_pressure" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the pressure profile by integrating the density</p>
<p>Compute the pressure as a function of depth by integrating the density, 
given by the temperature and salinity profiles and the seawater equation 
of state in <cite>seawater.density</cite>.  The depth coordinate can be either 
positive or negative, and the free surface can be located either in the 
first index to the <cite>z</cite>-array (<cite>fs_loc</cite> = 0) or the last row of the 
<cite>z</cite>-array (<cite>fs_loc</cite> = -1).  The data are returned in the same order as the 
input.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>z</strong><span class="classifier">ndarray</span></dt><dd><p>Array of depths in meters.</p>
</dd>
<dt><strong>T</strong><span class="classifier">ndarray</span></dt><dd><p>Array of temperatures (K) at the corresponding depths in <cite>z</cite>.</p>
</dd>
<dt><strong>S</strong><span class="classifier">ndarray</span></dt><dd><p>Array of salinities (psu) at the corresponding depth in <cite>z</cite>.</p>
</dd>
<dt><strong>fs_loc</strong><span class="classifier">integer (0 or -1)</span></dt><dd><p>Index to the location of the free-surface in the <cite>z</cite>-array.  0 
corresponds to the first element of <cite>z</cite>, -1 corresponds to the last 
element.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>P</strong><span class="classifier">ndarray</span></dt><dd><p>Array of pressures (Pa) at the corresponding depth in <cite>z</cite>.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>TAMOC requires the pressure as an input since seawater is compressible 
over modest ocean depths.  In order to avoid having to integrate the 
pressure over the depth anytime the density is needed, <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> expects 
the pressures to have been computed <em>a priori</em>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">z</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="o">-</span><span class="mi">1500</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">T</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mf">4.1</span><span class="p">,</span> <span class="mf">25.0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">z</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">S</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mf">36.5</span><span class="p">,</span> <span class="mf">34.5</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">z</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">fs_loc</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span> <span class="o">=</span> <span class="n">compute_pressure</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">T</span><span class="p">,</span> <span class="n">S</span><span class="p">,</span> <span class="n">fs_loc</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="go">-10</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="go">1558721.446785233</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">-1500</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">P</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">150155213.18007597</span>
</pre></div>
</div>
</dd></dl>

</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../../index.html">Texas A&M Oil spill / Outfall Calculator</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../../user_manual.html">TAMOC User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../unit_tests.html">Unit Tests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../bugs.html">Reporting Bugs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">Read Me File</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../release.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../license.html">License</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../../index.html">Documentation overview</a><ul>
  <li><a href="../../user_manual.html">TAMOC User Manual</a><ul>
  <li><a href="../../modules/ambient.html">Overview of Ambient Module</a><ul>
      <li>Previous: <a href="ambient.stabilize.html" title="previous chapter">ambient.stabilize</a></li>
      <li>Next: <a href="ambient.convert_units.html" title="next chapter">ambient.convert_units</a></li>
  </ul></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2020, Scott A. Socolofsky.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="../../_sources/autodoc/ambient/ambient.compute_pressure.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>